<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<!--使用code mirror创建一个web代码编辑器 -->
<!--Code Mirror必须引入这两个-->
<link rel="stylesheet" href="/codemirror-5.31.0/lib/codemirror.css"
	th:href="@{/codemirror-5.31.0/lib/codemirror.css}" />
<script src="/codemirror-5.31.0/lib/codemirror.js"
	th:src="@{/codemirror-5.31.0/lib/codemirror.js}"></script>
<!--Java代码高亮必须引入-->
<script src="/codemirror-5.31.0/clike.js"
	th:src="@{/codemirror-5.31.0/clike.js}"></script>
<!--groovy代码高亮-->
<script src="/codemirror-5.31.0/mode/groovy/groovy.js"
	th:src="@{/codemirror-5.31.0/mode/groovy/groovy.js}"></script>
<!--python代码高亮-->
<script src="/codemirror-5.31.0/mode/python/python.js"
	th:src="@{/codemirror-5.31.0/mode/python/python.js}"></script>
<!--js代码高亮-->
<script src="/codemirror-5.31.0/mode/javascript/javascript.js"
	th:src="@{/codemirror-5.31.0/mode/javascript/javascript.js}"></script>
<!--引入css文件，用以支持主题-->
<link rel="stylesheet" href="/codemirror-5.31.0/theme/dracula.css"
	th:href="@{/codemirror-5.31.0/theme/dracula.css}" />
<!-- <link rel="stylesheet" href="/codemirror-5.31.0/theme/idea.css"
	th:href="@{/codemirror-5.31.0/theme/idea.css}" /> -->

<!--支持代码折叠-->
<link rel="stylesheet"
	href="/codemirror-5.31.0/addon/fold/foldgutter.css"
	th:href="@{/codemirror-5.31.0/addon/fold/foldgutter.css}" />
<script src="/codemirror-5.31.0/addon/fold/foldcode.js"
	th:src="@{/codemirror-5.31.0/addon/fold/foldcode.js}"></script>
<script src="/codemirror-5.31.0/addon/fold/foldgutter.js"
	th:src="@{/codemirror-5.31.0/addon/fold/foldgutter.js}"></script>
<script src="/codemirror-5.31.0/addon/fold/brace-fold.js"
	th:src="@{/codemirror-5.31.0/addon/fold/brace-fold.js}"></script>
<script src="/codemirror-5.31.0/addon/fold/comment-fold.js"
	th:src="@{/codemirror-5.31.0/addon/fold/comment-fold.js}"></script>
<!--括号匹配-->
<script src="/codemirror-5.31.0/addon/edit/matchbrackets.js"
	th:src="@{/codemirror-5.31.0/addon/edit/matchbrackets.js}"></script>
<!--end Code Mirror -->
<meta charset="utf-8">
<head th:include="include :: header">
</head>
<link href="/rzspider/css/RZSpider.css"
	th:href="@{/rzspider/css/RZSpider.css}" rel="stylesheet" />
<link href="/ajax/libs/jquery-layout/jquery.layout-latest.css"
	th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}"
	rel="stylesheet" />
<link href="/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css"
	th:href="@{/ajax/libs/jquery-ztree/3.5/css/metro/zTreeStyle.css}"
	rel="stylesheet" />
<link href="/css/layui.css" th:href="@{/css/layui.css}" rel="stylesheet">
<style type="text/css">
div#rMenu {
	position: absolute;
	display: none;
	top: 0;
	background-color: #fff;
	text-align: left;
	padding: 2px;
}

div#rMenu a {
	cursor: pointer;
	list-style: none outside none;
}
</style>
<body class="white-bg" id="showfull">
	<!-- <div class="ui-layout-west">xcbvc</div>
	<div class="ui-layout-center">cbvcb</div>
	<div>
		<div class="ui-layout-west">vbn</div>
		<div class="ui-layout-center"></div>
	</div> -->
	<div class="ui-layout-west">
		<div class="main-content">
			<div class="box box-main">
				<div class="box-header">
					<input id="customSpiderId" name="customSpiderId"
						th:value="${customspider.customSpiderId}" type="hidden"> <input
						id="customSpiderBackId" name="customSpiderBackId"
						th:value="${customspider.customSpiderBackId}" type="hidden">
					<input id="spiderCodeTypeFolder" name="spiderCodeTypeFolder"
						th:value="${customspider.spiderCodeTypeFolder}" type="hidden">
					<input id="runStatus" name="runStatus"
						th:value="${customspider.runStatus}" type="hidden">
					<div class="box-title">
						<i class="fa icon-grid"></i> 代码管理（Java）
					</div>
					<div class="box-tools pull-right">
						<button type="button" class="btn btn-box-tool" id="btnExpand"
							title="展开" style="display: none;">
							<i class="fa fa-chevron-up"></i>
						</button>
						<button type="button" class="btn btn-box-tool" id="btnCollapse"
							title="折叠">
							<i class="fa fa-chevron-down"></i>
						</button>
						<button type="button" class="btn btn-box-tool" id="btnRefresh"
							title="刷新目录">
							<i class="fa fa-refresh"></i>
						</button>
					</div>
				</div>
				<div class="ui-layout-content">
					<div id="tree" class="ztree"></div>
				</div>
				<div id="rMenu">
					<a id="openFile" style="display: none" href="javascript:void(0)"
						class="list-group-item" onclick="openFile();">打开文件</a> <a
						id="newFile" style="display: none" href="javascript:void(0)"
						class="list-group-item" onclick="newFile();">新建文件</a> <a
						id="deleteFile" style="display: none" href="javascript:void(0)"
						class="list-group-item" onclick="deleteFile();">删除文件</a> <a
						id="exportFile" style="display: none" href="javascript:void(0)"
						class="list-group-item" onclick="exportFile();">导出文件</a> <a
						id="importFile" style="display: none" href="javascript:void(0)"
						class="list-group-item" onclick="importFile();">上传文件</a>
				</div>
			</div>
		</div>
	</div>

	<div class="wrapper wrapper-content ui-layout-center">
		<button class="btn btn-outline btn-default" onclick="javascript:run()"
			shiro:hasPermission="spider:customspider:code:run" id="run"
			disabled="true">
			<i class="fa fa-play" style="color: green;"></i> 测试运行
		</button>
		<button class="btn btn-outline btn-default"
			onclick="javascript:stop()"
			shiro:hasPermission="spider:customspider:code:run" id="stop"
			style="display: none">
			<i class="fa fa-stop" style="color: red;"></i> 中止运行
		</button>
		<button class="btn btn-outline btn-default" disabled="true" id="save2"
			shiro:hasPermission="spider:customspider:code:fileSave">
			<i class="fa fa-save"></i> 保存编译
		</button>
		<button class="btn btn-outline btn-default"
			onclick="javascript:saveFile()" id="save" style="display: none"
			shiro:hasPermission="spider:customspider:code:fileSave">
			<i class="fa fa-save" style="color: CadetBlue;"></i> 保存编译
		</button>
		<div class="btn-group">
			<button type="button"
				class="btn btn-outline btn-default dropdown-toggle"
				data-toggle="dropdown">
				<span>其他操作</span> <span class="caret"></span>
			</button>
			<ul class="dropdown-menu" role="menu">
				<li><a id="exportProject" href="javascript:void(0)"
					style="display: none" onclick="exportProject();">导出项目</a></li>
				<li><a id="setEntryFile" href="javascript:void(0)"
					onclick="setEntryFile();" style="display: none">设为程序入口</a></li>
			</ul>
		</div>
		<!-- <a id="fullScreen" class="btn btn-outline btn-default"
			style="float: right"><i class="fa fa-arrows-alt"></i>全屏</a>  --><label
			id="fileName"></label>
		<!-- 代码编辑器 -->
		<div>&nbsp;</div>
		<div>
			<textarea class="form-control" id="code" name="code"></textarea>
		</div>
		<div>&nbsp;</div>
		<div class="box-title">
			<i class="fa fa-print"></i> 控制台 &nbsp;&nbsp;&nbsp;&nbsp; <a
				href="javascript:void(0)" onclick="clearConsole();"><i
				class="fa fa-trash"></i> 清空</a>
		</div>
		<div>&nbsp;</div>
		<div>
			<textarea class="form-control" id="console" name="console"></textarea>
		</div>
		<!-- 将选择的节点信息隐藏在此 -->
		<input type="hidden" id="childId"> <input type="hidden"
			id="parentId"> <input type="hidden" id="name">
	</div>
	<div th:include="include::footer"></div>
	<script src="/ajax/libs/jquery-layout/jquery.layout-latest.js"
		th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
	<script src="/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js"
		th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
	<script src="/ajax/libs/webSocketStomp/sockjs.min.js"
		th:src="@{/ajax/libs/webSocketStomp/sockjs.min.js}"></script>
	<script src="/ajax/libs/webSocketStomp/stomp.min.js"
		th:src="@{/ajax/libs/webSocketStomp/stomp.min.js}"></script>
	<script src="/rzspider/spider/customspider/code/javacs.js"
		th:src="@{/rzspider/spider/customspider/code/javacs.js}">
	</script>
	<!-- 全屏 -->
	<script src="/ajax/libs/fullscreen/jquery.fullscreen.js"
		th:src="@{/ajax/libs/fullscreen/jquery.fullscreen.js}"></script>
	<!-- 轮询 -->
	<script src="/rzspider/spider/customspider/code/websocketconsole.js"
		th:src="@{/rzspider/spider/customspider/code/websocketconsole.js}">
	</script>
	<script src="/js/layui.js" th:src="@{/js/layui.js}"></script>
	<script th:inline="javascript">
	 var newFileFlag = [[${@permissionService.hasPermi('spider:customspider:code:newFile')}]];
        var deleteFileFlag = [[${@permissionService.hasPermi('spider:customspider:code:deleteFile')}]];
        var importFileFlag = [[${@permissionService.hasPermi('spider:customspider:code:importFile')}]];
        var exportFileFlag = [[${@permissionService.hasPermi('spider:customspider:code:exportFile')}]];
        var fileSaveFlag = [[${@permissionService.hasPermi('spider:customspider:code:fileSave')}]];
        if (exportFileFlag == 'hidden') {
    		$("#exportProject").css('display', 'none');
    	}else{
    		$("#exportProject").css('display', 'block');
    	}
    </script>
</body>
</html>
